const API = require('../../pages/api/index')
const { typeJson } = require('../../utils/typejson')
let prolist = wx.getStorageSync('prolist')==''?wx.getStorageSync('prolist'):JSON.parse(wx.getStorageSync('prolist'))


Page({

  /**
   * 页面的初始数据
   */
  data: {
    pulldown:"",
    pullup:2,
    addButton:true,
    prolist:wx.getStorageSync('prolist')==''?wx.getStorageSync('prolist'):JSON.parse(wx.getStorageSync('prolist')),
    listConfig: [
        {
          label: '检查人',
          prop: 'checkMan'
        },
        {
          label: '记录日期',
          prop: 'checkDate'
        }
      ],

 
      formConfig: [
      
        {
          label: '计划名称',
          prop: 'planId',
          type: 'dropDownSearch',
          required:true,
          hidden: 'look',
          net: {
            url: '/app/checkPlan/getList',
            method: 'post',
            key: 'planName',
            data:{
              mineId: true,
              planType:3 
            },
            value: 'id'
          }
        },
        {
          label:"计划名称",
          prop:'planName',
          hidden:'edit'
        },
    
        {
          label: '检查人',
          prop: 'checkManId',
          type: 'dddropDownSearch',
          hidden: 'look',
          required: true,
          net: {
            url: '/system/user/list',
            method: 'get',
            key: 'nickName',
            data: {
              mineId: true,
            },
            value: 'memberId'
          }
        },
       
        {
          label: "记录日期",
          prop: "checkDate",
          required:true,
          type:'date'
        },
          {
            label: "检查情况",
            prop: "situation",
            type:"textarea",
          },
          {
            label: "隐患数量",
            prop: "riskQty",
            type:'number'
          },
          {
            label: '是否存在隐患',
            prop: 'isRisk',
            jsonType: typeJson.isRisk,
            required:true,
            type: 'dropDown'
          },
          {
            label: "隐患描述",
            prop: "content",
            type:"textarea",
          },
          {
            label: "来源",
            prop: "source", 
            jsonType:typeJson.source,
            type: "dropDown",
            
          },
          {
            label: "隐患部位",
            prop: "part",
            
          },
          {
            label: "隐患级别",
            prop: "level",
            type: "dropDown",
            jsonType: typeJson.level,
            
          },
          {
            label: "核查人",
            prop: "verifyManId",
            type: 'dropDownSearch',
            hidden: 'look',
            
            net: {
              url: '/app/memberinfo/getList',
              method: 'post',
              key: 'nickName',
              data:{
                mineId: true,
              },
              value: 'memberId'
            }
          },
          {
            label: "发现时间",
            prop: "discoverDate",
            
            type:"date"
          },
          {
            label: '照片',
            prop: 'photo',
            type: 'image'
          },
       
        ],
    
        
        net: {
       
            select: {
              url: `/app/checkRec/getList`,
              method: 'post',
              data: {
                mineId: true,
                planType:3 
              }
            },
            delete: {
              url: '/app/checkRec/delete',
              method: 'get',
              data: {
                
              }
            },
            insert: {
              url: '/app/checkRec/insert',
              method: 'post',
              data: {
                mineId:true,
                
                
              }
            },
            update: {
              url: '/app/checkRec/update',
              method: 'post',
              data: {
  
              }
            }
  
          
        },
        showCom:true
      },

     
  

  /**
   * 生命周期函数--监听页面加载
   */


  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },
  
  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    console.log('5555');
    this.setData({
      showCom: false
    });
    this.setData({
      showCom: true
    });
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

   /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
    wx.stopPullDownRefresh()
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    this.setData({
      pullup: this.data.pullup + 1
    })
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})